import hashlib, binascii, uuid, random, binascii


class Node:


    def __init__(self, nodeID = None):
        u = uuid.uuid4()
        self.midNode = None
        self.left_start = None
        self.left_end = None
        self.right_start = None
        self.right_end = None
        self.nodeID = nodeID
        self.nodeID = u.hex
        self.nodeID_int = u.int

    def make_interval(self):
        if self.nodeID_int < (1 << 127) :
            self.midNode = self.nodeID_int + (1 << 127)
            self.left_start = self.midNode + 1 #left_start ~ 0 and  1 ~ nodeID - 1
            self.left_end = self.nodeID_int -1
            self.right_start = self.nodeID_int
            self.right_end = self.midNode
        else:
            self.midNode = self.nodeID_int - (1 << 127)
            self.left_start = self.midNode + 1 #left_start ~ 0 and  1 ~ nodeID - 1
            self.left_end = self.nodeID_int -1
            self.right_start = self.nodeID_int
            self.right_end = self.midNode




    def get_nodeID(self):
        return self.nodeID


if __name__ == '__main__':
    node = Node()
    nodeID = node.get_nodeID()